package priv.pattern.compositemode;

import priv.pattern.compositemode.service.Shape;
import priv.pattern.compositemode.service.impl.Circle;
import priv.pattern.compositemode.service.impl.CompoundShape;
import priv.pattern.compositemode.service.impl.Dot;
import priv.pattern.compositemode.service.impl.Rectangle;

import java.awt.*;

/*
 * 作者：m鹏h
 * 时间；2024/8/5 18:05
 * 描述： 结合模式 （组合模式） 客户端代码
 **/
public class compositeModeTest {
 public static void main(String[] args) {
  ImageEditor editor = new ImageEditor();

  editor.loadShapes(
          new Circle(10, 10, 10, Color.BLUE),

          new CompoundShape(
                  new Circle(110, 110, 50, Color.RED),
                  new Dot(160, 160, Color.RED)
          ),

          new CompoundShape(
                  new Rectangle(250, 250, 100, 100, Color.GREEN),
                  new Dot(240, 240, Color.GREEN),
                  new Dot(240, 360, Color.GREEN),
                  new Dot(360, 360, Color.GREEN),
                  new Dot(360, 240, Color.GREEN)
          )
  );
 }
}